import {
  getTianDianConfig,
  getYunFanConfig,
  postTianDianConfig,
  postYunFanConfig,
} from '@/api/modules/datasource.api';
import { API_STORE } from '../form/data';

export const fetchYunFan = async () => {
  const { data } = await getYunFanConfig();
  return data.data;
};

export const fetchTianDian = async () => {
  const { data } = await getTianDianConfig();
  return data.data;
};
/* 拉取店铺数据 */
export const fetchStoreDataMap: Record<API_STORE, any> = {
  /* 云帆 */
  yf: fetchYunFan,
  /* 天店 */
  td: fetchTianDian,
};

/* 提交店铺数据 */
export const postApiDataMap: Record<API_STORE, any> = {
  [API_STORE.yf]: postYunFanConfig,
  [API_STORE.td]: postTianDianConfig,
};
